(function($) {
	
	$.Dialog = {
	
		//Alert警告框
		Alert : function (title,content,style) {
			if(title == undefined || title == "") title = '提示信息';
			if(content == undefined || content == "") content = "请填写提示内容。";
			switch(style) {
				case "red":
					tColor = "#FFFFFF";
					cColor = "#333333";
					bdcolor = '#CC1111';
					bgcolor = '#EF1E16';
					break;
				case "orange":
					tColor = "#FFFFFF";
					cColor = "#333333";
					bdcolor = '#FF9900';
					bgcolor = '#FFB442';
					break;
				case "green":
					tColor = "#FFFFFF";
					cColor = "#333333";
					bdcolor = '#009900';
					bgcolor = '#59C114';
					break;
				case "black":
					tColor = "#FFFFFF";
					cColor = "#000000";
					bdcolor = '#000000';
					bgcolor = '#666666';
					break;
				case "grey":
					tColor = "#555555";
					cColor = "#555555";
					bdcolor = '#BBBBBB';
					bgcolor = '#EEEEEE';
					break;
				case "default":
					tColor = "#FFFFFF";   //默认标题文字颜色
					cColor = "#000000";   //黑认内容文字颜色
					bdcolor = '#4E86C4';   //默认边框颜色
					bgcolor = '#89B5E9';   //默认标题背景颜色
				default:
					tColor = "#FFFFFF";
					cColor = "#000000";
					bdcolor = '#4E86C4';
					bgcolor = '#89B5E9';
			};
			
			$.Dialog._AlertFunc(title,content,bdcolor,bgcolor,tColor,cColor);
		},
		
		_AlertFunc : function(title,content,bdcolor,bgcolor) {
			var garyDiv = "<div id='garyDiv' style='width:"
					+ $(window).width()
					+ "px; height:"
					+ ($(document).height() - 5)
					+ "px; border:none; background:#DDDDDD; position:absolute; top:0px; left:0px; z-index:1; opacity:0.3; filter:alpha(opacity=30); display:none;'></div>";
			var alertDiv = "<div id='alertDiv' style='width:260px; border:1px solid "
					+ bdcolor
					+ "; background:#FFFFFF; position:absolute; top:"
					+ ($(window).height() / 2 + $(document).scrollTop() - 80)
					+ "px; left:"
					+ ($(window).width() / 2 - 180)
					+ "px; z-index:3; -moz-border-radius:3px; -webkit-border-radius:3px; display:none;'><h5 style='color:"
					+ tColor
					+ "; font:12px Verdana; font-weight:bold; height:24px; background:"
					+ bgcolor
					+ "; margin:0px; padding:10px 10px 0px 10px;'><p style='float:left; margin:0px;'>"
					+ title
					+ "</p><p id='closeText' style='width:12px; height:12px; line-height:12px; _line-height:14px; text-align:center; float:right; margin:0px; overflow:hidden; cursor:pointer;'>X</p></h5><div style='color:"
					+ cColor
					+ "; border:0px solid red; line-height:20px; padding:15px 10px;'>"
					+ content
					+ "</div><div style='text-align:right; padding:0px 10px 10px 10px;'><input type='button' value='确定' id='close' style='width:50px; height:22px; line-height:20px; font-size:12px; border:1px solid; border-color:#EEE #333 #333 #EEE; cursor:pointer;'/></div></div>";
			$("body").append(garyDiv,alertDiv);
			$("#garyDiv,#alertDiv").fadeIn(300);
			$("#alertDivBg").fadeIn(300);
			
			//下方关闭按钮
			$("#closeText,#close").click(function() {
				$("#alertDiv,#garyDiv,#alertDivBg").fadeOut(200,function() {
					$(this).remove();
				});
			});
			
			//上方关闭按钮
			$("#closeText").hover(function() {
				$(this).css({color:bgcolor,background:tColor});
			},function() {
				$(this).css({color:tColor,background:bgcolor});
			});
			
			//改变窗体
			$(window).resize(function(){
				$("#garyDiv").css({width:$(window).width(),height:$(document).height()})
				$("#alertDiv").css({position:"absolute",top:($(window).height()/2 + $(document).scrollTop() - 80),left:($(window).width()/2 - 190)});
				$("#alertDivBg").css({position:"absolute",top:$("#alertDiv").offset().top + 6,left:$("#alertDiv").offset().left + 6});
			});
		}
		
	};
	
	//�������
	iAlert = function(title,content,style) {
		$.Dialog.Alert(title,content,style);
	};
	
	
})(jQuery);




